package testcase;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import control.Crop;

public class CropTest {
	
	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}
	
	/**test it is nothing in the images array before crop*/
	@Test
	public void testCrop() {
		class CropStub extends Crop{
			/**
			 * 
			 */
			private static final long serialVersionUID = 400L;
			public CropStub(String img, int cropwidth, int cropheight){
				super(img,cropwidth,cropheight);
			}
			public void startCrop_1(int x, int y,int w, int h, int imgW, int imgH) {
				/**do nothing*/
			}
		}
		CropStub cropStub = new CropStub("/images/dice/Dices.png",47,57);
		assertEquals(0,cropStub.getImages().size());
	}

	@Test
	public void testStartCrop_1() {
		/**if the cropHeight is larger then image height*/
		Crop crop1 = new Crop("/images/dice/Dices.png",47,65); 
		assertEquals(0,crop1.getImages().size());
		
		/**if the cropWidth is larger than image width*/
		Crop crop2 = new Crop("/images/dice/Dices.png",290,57);
		assertEquals(0,crop2.getImages().size());
		
		/**if this is fit and suitable to crop : 282/47*/
		Crop crop3 = new Crop("/images/dice/Dices.png",47,57);
		assertEquals(6,crop3.getImages().size());
	}

}
